// 删除有序数组中的重复项

// 双指针
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int cur = 1;
        int val = nums[0];
        int size = nums.size();
        if(size == 0)
        {
            return 0;
        }
        for(int next = 1; next < size; ++next)
        {
            if(nums[next] != val)
            {
                val = nums[next];
                nums[cur++] = val;
            }
        }
        return cur;
    }
};
